#pragma once
#include "lockqueue.h"
#include <string>
enum LOG_LEVEL
{
    INFO,
    ERROR,
};
#define LOGGER_INFO(logmsgformat,...)\
    do\
    {\
        Logger& logger=Logger::getInstance();\
        logger.setLogLevel(INFO);\
        char c[1024]={0};\
        snprintf(c,1024,logmsgformat,##__VA_ARGS__);\
        logger.log(c);\
    }while(0);

#define LOGGER_ERROR(logmsgformat,...)\
    do\
    {\
        Logger& logger=Logger::getInstance();\
        logger.setLogLevel(ERROR);\
        char c[1024]={0};\
        snprintf(c,1024,logmsgformat,##__VA_ARGS__);\
        logger.log(c);\
    }while(0);


class Logger
{
public:
    static Logger& getInstance();
    void setLogLevel(LOG_LEVEL level);
    void log(std::string msg);

private:
    int m_loglevel;
    LockQueue<std::string> lockqueue_;

    Logger();
    Logger(const Logger& )=delete;
    
};